//
//  MineAccountTableViewCell.swift
//  FrameProduct
//
//  Created by delegate on 2025/10/23.
//

import UIKit

class MineAccountTableViewCell: UIView {
    var mineAccountViewDidTapActionBlock:(() -> Void)?
    override init(frame: CGRect) {
        super.init(frame: frame)
        let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction))
        addGestureRecognizer(tap)
        addSubviews(titleLabel, arrowImageView, subTitleLabel)
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
        }
        arrowImageView.snp.makeConstraints {make in
            make.right.equalTo(-20)
            make.centerY.equalToSuperview()
            make.width.height.equalTo(32)
        }
        subTitleLabel.snp.makeConstraints { make in
            make.right.equalTo(arrowImageView.snp.left).offset(-10)
            make.centerY.equalToSuperview()
            make.height.equalTo(20)
        }
    }
    @objc private func tapAction() {
        mineAccountViewDidTapActionBlock?()
    }
    var titleStr: String = "" {
        didSet {
            titleLabel.text = titleStr
        }
    }
    var subTitleStr: String = "" {
        didSet {
            subTitleLabel.text = subTitleStr
        }
    }
    var arrowIconStr: String = "mine_arrow_icon" {
        didSet {
            arrowImageView.image = UIImage(named: arrowIconStr)
        }
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    //=================================================================
    //                            lazy
    //=================================================================
    // MARK: - lazy
    private lazy var arrowImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "mine_arrow_icon")
        imageView.isUserInteractionEnabled = true
        imageView.contentMode = .scaleAspectFit
        return imageView
    }()
    private lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.text = "账号与安全"
        label.textColor = .lxs.hex("#FFFFFF")
        label.font = .lxs.font(size: 14)
        return label
    }()
    private lazy var subTitleLabel: UILabel = {
        let label = UILabel()
        label.text = ""
        label.textColor = .lxs.hex("#FFFFFF")
        label.font = .lxs.font(size: 12)
        return label
    }()
}
